package com.itheima.reggie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.reggie.entity.DishFlavor;
import com.itheima.reggie.mapper.DishFlavorMapper;
import com.itheima.reggie.service.IDishFlavorService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 菜品口味关系表 服务实现类
 * </p>
 *
 * @author 陈振豪
 * @since 2024-10-02
 */
@Service
public class DishFlavorServiceImpl extends ServiceImpl<DishFlavorMapper, DishFlavor> implements IDishFlavorService {

    @Autowired
    private DishFlavorMapper dishFlavorMapper;

    /**
     * 根据菜品id查询该菜品的口味情况
     *
     * @param id
     * @return
     */
    @Override
    public List<DishFlavor> selectByDishId(Long id) {
//        LambdaQueryWrapper<DishFlavor> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(DishFlavor::getDishId,id);
//        List<DishFlavor> dishFlavors = dishFlavorMapper.selectList(queryWrapper);
        List<DishFlavor> dishFlavors = dishFlavorMapper.selectAllFlavor(id);
        return dishFlavors;
    }
}
